Skip to content

Use get_parent_theme_file_uri() for theme stylesheets - #150

Merged
MaggieCabrera merged 4 commits into
WordPress:trunkfrom
shail-mehta:fix/parent-theme-stylesheet-uris
Oct 20, 2026
Merged

MaggieCabrera merged 4 commits into
WordPress:trunkfrom
shail-mehta:fix/parent-theme-stylesheet-uris

Conversation

@shail-mehta

@shail-mehta shail-mehta commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Description

This is a small parent-theme improvement: load Ipsum’s stylesheets with get_parent_theme_file_uri() so the parent CSS continues to load correctly when a child theme is active.

Ipsum already works well on its own. Relative stylesheet paths and get_stylesheet_directory_uri() resolve to the active theme, which is usually fine, but with a child theme they can point at the child instead of Ipsum. Using get_parent_theme_file_uri() keeps parent style.css and editor-style.css available in both cases, similar to Twenty Twenty-Five.

Changes

  • functions.php
    • Front end: enqueue style.css with get_parent_theme_file_uri( 'style.css' ).
    • Editors: register style.css and assets/css/editor-style.css with get_parent_theme_file_uri().

No intentional visual change when Ipsum is used without a child theme.

Testing Instructions

  1. Start the local environment.
  2. With Ipsum active, check the front end and the Site Editor / page editor.
  3. Confirm styles look the same as before.
  4. Optional: try a minimal child theme and confirm Ipsum’s parent stylesheets still load.
  5. Run npm run lint:php if PHPCS is set up locally.

Use of AI Tools

  • Cursor for the PR Description

@github-actions github-actions Bot added the [Area] Theme Functions Issues or PRs that touch functions.php. label Oct 9, 2026
@shail-mehta
shail-mehta marked this pull request as ready for review October 9, 2026 06:59
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: shail-mehta <shailu25@git.wordpress.org>
Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

shail-mehta and others added 3 commits October 14, 2026 09:41
add_editor_style() fetches full URLs over HTTP when the block editor loads.
That request fails on hosts that block loopbacks, including wp-env, which
drops the editor styles. Relative paths are read from disk, as in the
default themes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@MaggieCabrera MaggieCabrera left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept your front-end change and reverted the add_editor_style() one. When it gets a full URL, the block editor fetches the file over HTTP on every load. That request fails on wp-env and on hosts that block requests back to themselves, so the editor styles disappear. Relative paths are read from disk, which is also what the default themes do.

@MaggieCabrera
MaggieCabrera merged commit 9b8f8f0 into WordPress:trunk Oct 20, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Theme Functions Issues or PRs that touch functions.php.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants